package com.common.retrofit.methods;

import com.common.cons.Constans;
import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.service.HaiNingService;
import com.common.utils.SortUtils;
import rx.Observable;
import rx.Subscriber;

public class AddCarMethods extends BaseMethods {

    private static AddCarMethods m_ins = null;

    public static AddCarMethods getInstance() {
        if (m_ins == null) {
            synchronized (AddCarMethods.class) {
                if (m_ins == null) {
                    m_ins = new AddCarMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "Api/Car/";
    }

    private HaiNingService initService() {
        return getRetrofit().create(HaiNingService.class);
    }


    public void     addCar  (Subscriber<Object> subscriber,
                      int uid,
                      String hashid ,int typeid,String brand
            ,String model
            ,String carnum
            ,String color
            ,String id
            ,String typename

    ) {
        Observable observable = initService().addCar(System.currentTimeMillis()+"",
                SortUtils.getMyHash("uid","hashid","typeid"
                        ,"brand"
                        ,"model"
                        ,"carnum"
                        ,"color"
                        ,"id"
                        ,"typename"
                ), Constans.ANDROID_APP_ID,"3",uid,hashid,typeid,brand,model,carnum,color,id,typename
        );
        toSubscribe(observable, subscriber);
    }
}
